﻿@using KPIS.GERP.Models.ICM
@model KPIS.GERP.Models.ICM.Dispense

@{
    
}

@Html.HiddenFor(model=>model.RequestById,new{ id="hdReqById"})
@Html.HiddenFor(model=>model.WhId,new{ id="hdWhId"})
@Html.HiddenFor(model=>model.FromJobSiteId,new{ id="hdJobSiteId"})
@Html.HiddenFor(model=>model.ProjectId,new{ id="hdProjectId"})
@Html.HiddenFor(model=>model.ApprovedBy,new{ id="hdApprovedBy"})
@Html.HiddenFor(model=>model.ApprovedWhen,new{ id="hdApprovedWhen"})


<div class="widget-box span8">
	<div class="widget-header header-color-blue2">
        <h4 class="lighter smaller">เพิ่มรายการจ่าย</h4>
    </div>
	<div class="widget-body">
		<div class="widget-body-inner">
			<div class="widget-main">
				<div class="control-group">
					<div class="control-label">
						  @Html.DisplayNameFor(model => model.DispenseDate)
					</div>
					<div class="controls">   
						@Html.TextBoxFor(model => model.DispenseDate, new { id="txtDispenseDate", @class="date-picker"})
                        <text id="lblDispenseDate" style="display:none; color:red">*</text>
					</div>                              
				</div>
                @if (ViewBag.State == "Edit")
                { 
                    <div class="control-group">
					<div class="control-label">
						 @Html.DisplayNameFor(model => model.RequestParcelId)
					</div>
					<div class="controls" style="margin-top:5px !important;">                       
                        @Html.HiddenFor(model=>model.DispenseId)
                        @Html.HiddenFor(model=>model.DispenseDate)   
                        @Html.HiddenFor(model=>model.RecordStatus)
                        @Html.HiddenFor(model=>model.CreatedBy)
                        @Html.HiddenFor(model=>model.CreatedWhen)

                        @Html.HiddenFor(model => model.RequestParcelId, new { id="hdReqId"}) 
						@Html.DisplayTextFor(model=> model.RequestParcel.IcmReqCode) 
					</div>                              
				    </div>
                }
                else
                {
                <div class="control-group">
					<div class="control-label">
						 @Html.DisplayNameFor(model => model.RequestParcelId)
					</div>
					<div class="controls">   
						@Html.DropDownListFor(model=> model.RequestParcelId, new KPIS.GERP.WEB.GIMS.DispenseService.DispenseServiceClient().GetRequest(),
                        "เลือกใบเบิก",
                        new { id="ddlRequestParcel", onchange = "FetchRequestParcel();" })
                        <text id="lblReqParcel" style="display:none; color:red">*</text>
					</div>                              
				</div>
                }
                <div class="control-group">
					<div class="control-label">
						  @Html.DisplayNameFor(model => model.DispenseName)
					</div>
					<div class="controls">   
						@Html.TextBoxFor(model => model.DispenseName, new { id="txtName" })
						<text id="lblName" style="display:none; color:red">*</text>
					</div>                              
				</div>
                <div class="control-group">
					<div class="control-label">
						  @Html.DisplayNameFor(model => model.Remark)
					</div>
					<div class="controls">   
						@Html.TextAreaFor(model=> model.Remark)
						@Html.ValidationMessageFor(model => model.Remark)
					</div>                              
				</div>
                <div class="control-group">
					<div class="control-label">
						  @Html.DisplayNameFor(model => model.RequestById)
					</div>
					<div class="controls">   
						@Html.TextBox("txtReqBy", "", new { @readonly="readonly"})
					</div>                              
				</div>
                <div class="control-group">
					<div class="control-label">
						  @Html.DisplayNameFor(model => model.WhId)
					</div>
					<div class="controls">   
						@Html.TextBox("txtWarehouse", "", new { @readonly="readonly"})
					</div>                              
				</div>
                <div class="control-group">
					<div class="control-label">
						  @Html.DisplayNameFor(model => model.FromJobSiteId)
					</div>
					<div class="controls">   
						@Html.TextBox("txtJobSite", "", new { @readonly="readonly"})
					</div>                              
				</div>
                <div class="control-group">
					<div class="control-label">
						  @Html.DisplayNameFor(model => model.ProjectId)
					</div>
					<div class="controls">   
						@Html.TextBox("txtProject", "", new { @readonly="readonly", style="width:400px"})
					</div>                              
				</div>
			</div>
		</div>
	</div> 
</div>
